<?php
namespace app\admin\validate;

class CourseCateValidate extends \think\Validate
{

    const SCENE_ADD = 'add'; //添加
    const SCENE_EDIT = 'edit'; //编辑
    const SCENE_REMOVE = 'remove'; //删除


    protected $rule = [
        'id' => 'require|number',
        'sort' => 'require|number',
        'title'  =>  'require|max:32',
        'summary'  =>  'require|max:200',
        
    ];


    protected $message  = [
        'id.require' => 'ID必须',
        'id.number' => 'ID必须为数字',
        'title.require' => '标题必须',
        'title.max' => '标题最长32',

        'summary.require' => '描述必须',
        'summary.max' => '描述最长200',
    ];
    
    //场景
    protected $scene  = [
       self::SCENE_ADD => ['title' ],
       self::SCENE_EDIT => ['id', 'title'],
       self::SCENE_REMOVE => ['id'],
    ];
}